/**
 * 敏感词表单配置
 * @typedef {Object} FormConfig
 */
export const formConfig = [
  {
    field: 'word',
    label: '敏感词',
    component: 'Input',
    placeholder: '请输入敏感词',
    rules: [
      { required: true, message: '请输入敏感词', trigger: 'blur' },
      { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' },
    ],
  },
  {
    field: 'wordType',
    label: '类型',
    component: 'Radio',
    options: [
      { label: '禁用词', value: '1' },
      { label: '替换词', value: '2' },
      { label: '审核词', value: '3' },
    ],
    rules: [{ required: true, message: '请选择类型', trigger: 'change' }],
  },
  {
    field: 'replaceWord',
    label: '替换内容',
    component: 'Input',
    placeholder: '请输入替换内容，默认为*',
    rules: [{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }],
    // 条件显示：只有当类型为替换词时才显示
    showCondition: (formData) => formData.wordType === '2',
  },
  {
    field: 'status',
    label: '状态',
    component: 'Radio',
    options: [
      { label: '启用', value: '1' },
      { label: '禁用', value: '0' },
    ],
    rules: [{ required: true, message: '请选择状态', trigger: 'change' }],
  },
]

/**
 * 获取表单默认值
 */
export const getDefaultFormData = () => {
  return {
    id: '',
    word: '',
    replaceWord: '',
    wordType: '1',
    status: '1',
  }
}
